<template>
  <div class="InfoCar" :style='[{backgroundImage: "url(" + CarList.bgImg + ")"}]'>
    <div class="Info-tit">
      <img :src='CarList.src' alt="">
      <span class="aid">{{CarList.InfoTit}}</span>
    </div>
    <div class="Info-con" v-if="CarList.decide">
      <span class="bedNo1">{{bedNo}}</span>
      <span class="bedNo2">床</span>
    </div>
    <div class="Info-date" v-else>
      <div>
        <span>{{time.Year}}年</span>
        <span>{{time.Month}}月</span>
        <span>{{time.Day}}日</span>
      </div>
      <div>
        <span>{{time.Hours}}时</span>
        <span>{{time.Mininte}}分</span>
<!--        <span>{{time.Second}}秒</span>-->
      </div>
    </div>
  </div>
</template>

<script>export default {
  name: 'InfoCar',
  props: ['CarListInfo'],
  data () {
    return {
      CarList: this.CarListInfo,
      boxShadow: this.CarListInfo.boxS,
      bedNo: '',
      time: ''
    }
  },
  methods: {
    system () {
      setInterval(() => {
        this.time = {
          Year: new Date().getFullYear(),
          Month: new Date().getMonth() + 1,
          Day: new Date().getDate(),
          Hours: new Date().getHours(),
          Mininte: new Date().getMinutes()
          // Second: new Date().getSeconds()
        }
      }, 1000)
    }
  },
  mounted () {
    this.bedNo = this.$store.state.personinfo.bed_no
    this.system()
  }
}
</script>

<style lang="stylus" scoped>
  .InfoCar {
    position: relative;
    width: 5.02rem;
    height: 4.22rem;
    border-radius: 0.12rem;
    color: #fff;
    background-size: 100% 100%;
  }

  .InfoCar .Info-tit {
    display: flex;
    align-items: center;
    height: .84rem;
    font-size: 0.3rem;
    // padding: 0.3rem;
  }

  .InfoCar .Info-tit img {
    width: 0.38rem;
    height: 0.34rem;
    margin: 0.3rem;
  }
  // 病床号
  .InfoCar .Info-con {
    position: absolute;
    width: 100%;
    text-align: center;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem
  }
  .InfoCar .Info-con .bedNo1{
    font-size: 1.2rem !important
  }
  .InfoCar .Info-con .bedNo2{
    font-size: 0.6rem !important
  }
  .InfoCar .Info-date {
    position: absolute;
    width: 100%;
    text-align: center;
    top: 50%;
    transform: translateY(-50%);
  }

  .InfoCar .Info-con>span:nth-child(1) {
    font-size: 1.45rem;
  }

  .InfoCar .Info-con>span:nth-child(2) {
    font-size: 1.5rem;
  }

  .InfoCar .Info-con>span:nth-child(3) {
    font-size: 0.6rem;
  }
  // 时间显示
  .InfoCar .Info-date>div{
    font-size: .4rem;
    padding: .2rem 0;
  }
</style>
